// 输入一个正整数n，输出所有和为n的连续正数序列
// 例如：n=15
// [
//   [1,2,3,4,5],
//   [4,5,6],
//   [7,8]
// ]
function createArr(i, j) {
  let arr = new Array(j).fill(null), temp = [];
  arr[0] = n;
  arr = arr.map((item, index) => {
    if (item === null) {
      item = temp[index - 1] + 1;
    }
    temp.push(item);
    return item
  })
  return arr
}
function fn(count) {
  let result = []
  let middle = Math.ceil(count / 2);
  for (let i = 1; i <= middle; i++) {
    for (let j = 2; j <= middle; j++) {
      let total = (i + (i + j - 1) * (j / 2));
      if (total > count) {
        break;
      } else if (total === count) {
        result.push(createArr(i, j))
        break
      }
    }
  }
  return result
}